package sb.bean.instantiation;

import ico.domain.User;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author 01395265
 * @description TODO
 * @date 2020/9/28
 */
public class BeanInstantiationDemo {

    public static void main(String[] args) {

        ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("META-INF/bean-instantiation-context.xml");

        User staticUser = applicationContext.getBean("user-by-static-method", User.class);
//        System.out.println("-----------------");
//        User instanceUser = applicationContext.getBean("user-by-instance-method", User.class);
//        System.out.println("-----------------");
//        User factoryUser = applicationContext.getBean("user-by-factory-bean", User.class);

        System.out.println(staticUser);
//        System.out.println(instanceUser);
//        System.out.println(factoryUser);
//
//        System.out.println(staticUser == instanceUser);
//        System.out.println(staticUser == factoryUser);
        applicationContext.close();

    }

}
